fix: wire up opportunity details save and fix UTC time round-trip bug#418
fix: wire up opportunity details save and fix UTC time round-trip bug#418
Conversation
|
Good fixes overall, the UTC time separation and the language reverse mapping bug are both real issues and the solutions look correct. The new hook follows the same pattern as the rest of the codebase, no issues there. Two small things worth checking: eventDate and eventTime are editable in the form but won't be persisted pending backend support, worth making them read-only/disabled in edit mode to avoid silent data loss. Also, does the new hook include title in its payload? If so, the existing useUpdateOpportunityTitle call might end up firing a redundant second PATCH when the title changes. |
|
One tiny edge-case I spotted in the time display: |
|
|
It's the same PATCH /api/opportunity/:id endpoint already used by useUpdateOpportunityDetails. The SDK type ApiOpportunityPatch already has the accompanyingDetails field for it: accompanyingDetails: { So the fix would just be adding accompanyingDetails to the updateOpportunityDetails call in onSubmit: accompanyingDetails: isEventType ? undefined : { |
District field in the Refugee Accommodation Centre edit form was a plain text input, making it impossible to consistently pick a valid district. Replaced with a radio-list dropdown fed from the districts API. Submission now sends the district ID instead of a raw string. Closes #357
Fix: No ZIP/PLZ-code for Accompanying details #344
Fix: helpers.ts
… UTC datetime-local input values are local time strings. Wrapping them in new Date().toISOString() converts to UTC, causing appointment times to display 2 hours early for UTC+2 users (CEST). Passing the value directly matches how onetime_date_time is handled in the same file. Closes #393 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Language purpose (GENERAL/TRANSLATION) was stripped from the form data during submission, causing saved languages to lose their purpose field. New languages default to GENERAL purpose. Closes #367
Fix: Accompanying details: add new row #386
- Adds useUpdateOpportunityDetails hook and wires it into OpportunityDetailsEdit so saving the form actually PATCHes the API (fixes #401) - Fixes toLangOptionItems to reverse the languagesToFormValues translation lookup, so languages initialised from the API in any locale still match on submit - Adds formatTimeForDisplay (UTC→local) separate from parseTime (form state), so AccompanyingDetailsDisplay shows local time without corrupting the value on each save (parseTime kept raw for form state) - Fixes formatAccompanyingDate UTC conversion to use explicit getHours/getMinutes instead of toTimeString() which is implementation-defined - Removes unused formatAccompanyingDate dead code added in the same diff Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… fields in getInitialFormValues Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…n utils Replaces the local formatTimeForDisplay implementation with a thin wrapper around the shared utcHhmmToLocal function exported from utils/index.ts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2cd7899 to
7612b7f
Compare
Summary
useUpdateOpportunityDetailshook and wires it intoOpportunityDetailsEditso saving the form actually PATCHes the API (fixes Opportunity profile: edited information in opportunity details is not saved #401)toLangOptionItemsto reverse thelanguagesToFormValuestranslation lookup — without this, languages initialised from the API in German locale were silently dropped on save because translated names ("Arabisch") never matched canonical API titles ("Arabic")formatTimeForDisplay(UTC→local) as a separate function fromparseTime(form state stays raw), soAccompanyingDetailsDisplayshows local time without corrupting the saved value on each edit (fixes the round-trip drift bug in fix: convert appointment time from UTC to local time for display #407 and fix: implement save mutation in opportunity details edit form #409)formatAccompanyingDateUTC conversion to use explicitgetHours/getMinutesinstead oftoTimeString()which is implementation-definedformatAccompanyingDatefunction that was added but never calledRelated issues / PRs
Notes
eventDateandeventTime(shown for EVENTS-type opportunities) are not included in the save payload — there is no corresponding field inApiOpportunityPatchand the display component already shows—for those fields. This needs a BE change to support.Test plan
🤖 Generated with Claude Code